home *** CD-ROM | disk | FTP | other *** search
/ Programming Microsoft Visual Basic .NET / Programming Microsoft Visual Basic .NET (Microsoft Press)(X08-78517)(2002).bin / setup / vbnet / 23 web forms and controls / firstwebforms / othercontrolsform.aspx.vb < prev    next >
Encoding:
Text File  |  2002-03-17  |  2.2 KB  |  52 lines

  1. Public Class OtherControlsForm
  2.     Inherits System.Web.UI.Page
  3.     Protected WithEvents Calendar1 As System.Web.UI.WebControls.Calendar
  4.     Protected WithEvents Xml1 As System.Web.UI.WebControls.Xml
  5.     Protected WithEvents Label1 As System.Web.UI.WebControls.Label
  6.     Protected WithEvents AdRotator1 As System.Web.UI.WebControls.AdRotator
  7.  
  8. #Region " Web Form Designer Generated Code "
  9.  
  10.     'This call is required by the Web Form Designer.
  11.     <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
  12.  
  13.     End Sub
  14.  
  15.     Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
  16.         'CODEGEN: This method call is required by the Web Form Designer
  17.         'Do not modify it using the code editor.
  18.         InitializeComponent()
  19.     End Sub
  20.  
  21. #End Region
  22.  
  23.     ' this event fires when the Calendar is rendering each of its cells
  24.  
  25.     Private Sub Calendar1_DayRender(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DayRenderEventArgs) Handles Calendar1.DayRender
  26.         ' Ensures that days 12/24 to 12/26 are displayed with yellow background.
  27.         If Not e.Day.IsOtherMonth Then
  28.             ' Consider only days in the current month.
  29.             If e.Day.Date.Month = 12 AndAlso e.Day.Date.Day >= 24 And e.Day.Date.Day <= 26 Then
  30.                 e.Cell.BackColor = Color.Yellow
  31.                 ' Prevent the user from selecting these days.
  32.                 e.Day.IsSelectable = False
  33.             End If
  34.         End If
  35.  
  36.         If e.Day.Date.Day = 1 Then
  37.             Dim imgCtrl As New System.Web.UI.WebControls.Image()
  38.             imgCtrl.ImageUrl = "file:///E:\Inetpub\wwwroot\warning.gif"
  39.             imgCtrl.Width = Unit.Percentage(100)
  40.             imgCtrl.Height = Unit.Percentage(100)
  41.             e.Cell.Text = ""
  42.             e.Cell.Controls.Add(imgCtrl)
  43.         End If
  44.     End Sub
  45.  
  46.     ' this event fires when the user selects a new date
  47.     Private Sub Calendar1_SelectionChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles Calendar1.SelectionChanged
  48.         Label1.Text = "Current Selected Date " & Calendar1.SelectedDate.ToLongDateString
  49.     End Sub
  50.  
  51. End Class
  52.